<template>
    <div class="PopupRecord">
        <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="visible" title=""
            :show-close="false" align-center class="dialogAdd">
            <div class="dialog_content">
                <div class="dialog_header">
                    <div class="title">
                        <img src="@/assets/images/rectangle07.png" alt="">
                        <span>执行情况记录</span>
                    </div>
                </div>
                <div class="dialog_details">
                    <div class="details">
                        <div class="search">
                            <el-form :model="state.formAdd" ref="formAddRef" label-position="right" class="form">
                                <el-form-item label="计划开始日期">
                                    <el-date-picker style="width: 260px;" v-model="receiptTime" type="daterange"
                                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                                        format="YYYY/MM/DD" value-format="YYYY-MM-DD" @change="changeReceiptTime"
                                        unlink-panels />
                                    <!-- <el-input v-model.trim="searchData.params.name" placeholder="操作时间" clearable></el-input> -->
                                </el-form-item>
                                <el-form-item label="实际开始日期">
                                    <el-date-picker style="width: 260px;" v-model="receiptTime2" type="daterange"
                                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                                        format="YYYY/MM/DD" value-format="YYYY-MM-DD" @change="changeReceiptTime"
                                        unlink-panels />
                                    <!-- <el-input v-model.trim="searchData.params.name" placeholder="操作时间" clearable></el-input> -->
                                </el-form-item>

                                <el-button type="primary">查询</el-button>
                            </el-form>
                        </div>
                        <div class="tableBg">
                            <el-table ref="tableRef" :data="state.tableData" style="width: 100%;" stripe
                                empty-text="暂无数据" :max-height="300" :scrollbar-always-on="true">
                                <el-table-column prop="name" label="执行状态"
                                    :min-width="flexWidth('name', state.tableData, '执行状态')" />
                                <el-table-column prop="time" label="计划开始执行时间"
                                    :min-width="flexWidth('time', state.tableData, '计划开始执行时间')" />
                                <el-table-column prop="time" label="计划结束执行时间"
                                    :min-width="flexWidth('time', state.tableData, '计划结束执行时间')" />
                                <el-table-column prop="name" label="执行期限"
                                    :min-width="flexWidth('name', state.tableData, '执行期限')" />
                                <el-table-column prop="name" label="实际执行人"
                                    :min-width="flexWidth('name', state.tableData, '实际执行人')" />
                                <el-table-column prop="time" label="实际执行时间"
                                    :min-width="flexWidth('time', state.tableData, '实际执行时间')" />
                            </el-table>
                        </div>
                        <div class="btn">
                            <el-button type="warning" @click="handleClose">确 认</el-button>
                            <el-button @click="handleClose">取 消</el-button>
                        </div>
                    </div>

                </div>
            </div>
        </el-dialog>
    </div>
</template>

<script setup lang="ts">
import { isButtonDisabled, flexWidth } from '@/utils/utils'
const props = defineProps({
    dialogVisible: {
        type: Boolean,
        default: false
    },
    type_dialog: {
        type: String,
        default: ''
    },
})

const state = reactive({
    tableData: [{
        name: '已执行', time: '2024-08-14 14:23:04'
    }],
    formAdd: { createTimeStart: '', createTimeEnd: '' }
})
let visible = ref(false);

const receiptTime = ref('') as any;//接收时间
const receiptTime2 = ref('') as any;//接收时间2

const changeReceiptTime = (val: string[]) => {
    console.log('val', val);
    if (val && val.length == 2) {
        state.formAdd.createTimeStart = val[0] + " 00:00:00";
        state.formAdd.createTimeEnd = val[1] + " 23:59:59";
    } else {
        state.formAdd.createTimeStart = "";
        state.formAdd.createTimeEnd = "";
    }
}
watch(() => props.dialogVisible, async (newValue, oldValue) => {
    visible.value = newValue;

});

//emit(父组件中的自定义方法)
const emit = defineEmits(['closeDialog']);

const handleClose = () => {
    emit("closeDialog");
}
</script>

<style scoped lang="scss">
.PopupRecord {
    :deep(.dialogAdd) {
        // width: 400px;
        width: 900px;
        min-height: 500px;
        background: rgba(255, 255, 255, 1);
        border-radius: 2px;
        box-shadow: 0px 6px 16px -8px rgba(0, 0, 0, 0.08), 0px 9px 28px 0px rgba(0, 0, 0, 0.05), 0px 12px 48px 16px rgba(0, 0, 0, 0.03);

        .el-dialog__header {
            padding: 0;

        }

        .el-dialog__body {
            padding: 0;

            .dialog_content {
                .dialog_header {
                    padding: 0;
                    height: 59px;
                    padding: 8px 32px 4px 62px;
                    line-height: 52px;
                    font-size: 16px;
                    font-weight: 400;
                    color: rgba(0, 0, 0, 1);
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    border-bottom: 1px dashed rgba(112, 105, 95, 1);

                    .title {
                        display: flex;
                        align-items: center;

                        img {
                            width: 4px;
                            height: 22px;
                            margin-right: 15px;
                        }

                    }

                    .close {
                        width: 25px;
                        height: 25px;
                        cursor: pointer;

                    }
                }

                .dialog_details {
                    padding: 25px 45px 50px 48px;
                    font-size: 16px;
                    font-weight: 400;
                    letter-spacing: 0px;
                    line-height: 30px;
                    color: rgba(0, 0, 0, 1);

                    .details {
                        .search {
                            flex: 1;
                            display: flex;
                            flex-wrap: wrap;
                            flex-shrink: 1;
                            min-width: 0;
                            margin-bottom: 10px;

                            .el-form {
                                display: flex;
                                flex-wrap: wrap;

                                .el-form-item {

                                    max-width: 45%;
                                    padding-right: 30px;

                                    // &.treeList {
                                    //     width: 40%;
                                    // }
                                    :deep(.select-trigger) {
                                        .el-input {
                                            width: 100%;
                                        }
                                    }

                                    :deep(.el-cascader) {
                                        width: 260px;

                                        .el-input {
                                            width: 100%;
                                        }
                                    }
                                }
                            }
                        }

                        .btn {
                            position: absolute;
                            bottom: 40px;
                            right: 77px;
                        }
                    }

                }

            }
        }


    }
}
</style>